package main

import (
	"gopkg.in/src-d/go-git.v4"
	"gopkg.in/src-d/go-git.v4/plumbing/transport/client"
	"gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
	"log"
)

const uri = "https://wwwin-github.cisco.com/liantan/doggie.git"

func main() {
	gitAuth, err := ssh.NewSSHAgentAuth()
	if err != nil {
		log.Fatalf("parseprivatekey: %v", err)
	}

	config, err := gitAuth.ClientConfig()
	if err != nil {
		log.Fatal(err)
	}
	customClient := ssh.NewClient(config)
	client.InstallProtocol("https", customClient)

	_, err = git.PlainClone("tmp", false, &git.CloneOptions{
		URL: uri,
	})
	if err != nil {
		log.Fatal(err)
	}

	log.Println("DONE")
}
